<%@ page language="java" import="java.util.*,java.io.*,javax.imageio.*,java.awt.*,java.awt.image.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@page contentType="image/png" language="java" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>九大隐士对象之Response</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    1.response响应生成非字符响应 <br>
    <%
    //创建BufferedImage对象
    BufferedImage image=new BufferedImage(340,160,BufferedImage.TYPE_INT_RGB);
    Graphics g=image.getGraphics();
    g.fillRect(0, 0, 400, 400);
    g.setColor(new Color(255,0,0));
    g.fillArc(20,20,100,100,30,120);
    g.setColor(new Color(0,255,0));
    g.fillArc(20,20,100,100,150,120);
    g.setColor(new Color(0,0,255));
    g.fillArc(20, 20, 100, 100, 270, 120);
    g.setColor(new Color(0,0,0));
    g.setFont(new Font("Arial Black",Font.PLAIN,16));
    g.drawString("red:climb",200,60);
    g.drawString("green:swim",200,100);
    g.drawString("blue:jump",200,140);
    g.dispose();
    
    ImageIO.write(image, "png", response.getOutputStream());
    
    
     %>
  </body>
</html>
